// strcmp模拟实现


#include <iostream>
#include <cassert>

int strcmp_self(const char* s1, const char* s2)
{
    assert(s1 != nullptr && s2 != nullptr);
    while(*s1 == *s2)
    {
        if(*s1 == '\0') return 0;
        ++s1;
        ++s2;
    }
    return *s1 - *s2;
}

int main()
{
    char s1[] = "abcdef";
    char s2[] = "abcd";
    if(strcmp_self(s1, s2) > 0)
    {
        std::cout << "s1 > s2" << std::endl;
    }
    else if(strcmp_self(s1, s2) == 0)
    {
        std::cout << "s1 = s2" << std::endl;
    }
    else
    {
        std::cout << "s1 < s2" << std::endl;
    }
        
    return 0;
}
